<include file="Public/header" title="添加项目" />
<style>
    label.block {
        display: block;
        margin-left: 15px;
    }
    .col-sm-10 input,
    .col-sm-11 input {
        display: inline-block;
        margin-left: 20px;
        border: 1px solid #222;
    }
    .btn-warning {
        background-color: #ccc;
        border-color: #ccc;
    }
    .btn-warning:hover {
        background-color: #ddd;
        border-color: #ddd;
    }
</style>
<div id="page-wrapper">
<form action="{:U('project/update',array('id'=>$page['id']))}" method="post"   enctype="multipart/form-data">
<!-- 项目名称 -->
    <div class="form-group">
        <label>项目名称</label>
        <input type="text" name="name" placeholder="大华锦绣华城" class="form-control" value="{$page['name']}" />
    </div>
<!-- 单套最高优惠 -->
    <div class="form-group">
        <label>折扣</label>
        <input type="text" name="discount" placeholder="3" class="form-control" value="{$page['discount']}"/>
    </div>
<!-- 单套最高优惠 -->
    <div class="form-group">
        <label>单套最高优惠</label>
        <input type="text" name="most_save" placeholder="3" class="form-control" value="{$page['most_save']}" />
    </div>
<!-- 可否用券 -->
    <div class="form-group">
        <label>可否用券</label>
        <label class="radio-inline">
            <input type="radio" name="coupon" value="1" />是
        </label>
        <label class="radio-inline">
            <input type="radio" name="coupon" value="0" />否
        </label>
    </div>
<!-- 收藏的人数/热度 -->
    <div class="form-group">
        <label>收藏的人数/热度</label>
        <input type="text" name="hot" placeholder="32" class="form-control" value="{$page['hot']}" />
    </div>
<!-- 筛选条件 -->
    <div class="form-group row">
        <label class="block">筛选条件</label>
        <label class="col-sm-1 control-label">区域</label>
        <div class="col-sm-10">
            <input type="radio" name="area" value="甘井子区" />甘井子区
            <input type="radio" name="area" value="沙河口区" />沙河口区 
            <input type="radio" name="area" value="西岗区" />西岗区               
            <input type="radio" name="area" value="中山区" />中山区
            <input type="radio" name="area" value="高新园区" />高新园区
            <input type="radio" name="area" value="金州区" />金州区 
            <input type="radio" name="area" value="其它市区" />其它市区                          
        </div>
    </div>
    <!-- <div class="form-group row">
        <label class="col-sm-1 control-label">户型</label>
        <div class="col-sm-11">
            <input type="checkbox" name="house_style[]" value="1室" />1室
            <input type="checkbox" name="house_style[]" value="2室" />2室 
            <input type="checkbox" name="house_style[]" value="3室" />3室              
            <input type="checkbox" name="house_style[]" value="3室以上" />3室以上             
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-1 control-label">地铁</label>
        <div class="col-sm-11">
            <input type="checkbox" name="metro[]" value="1号线" />1号线
            <input type="checkbox" name="metro[]" value="2号线" />2号线            
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-1 control-label">售价</label>
        <div class="col-sm-11">
            <input type="checkbox" name="price[]" value="8000-10000" />8000-10000
            <input type="checkbox" name="price[]" value="10000-12000" />10000-12000 
            <input type="checkbox" name="price[]" value="12000-14000" />12000-14000                            
        </div>
    </div> -->
<!-- 项目地址 -->
    <div class="form-group">
        <label>项目地址</label>
        <input type="text" name="location" placeholder="高新园区软件园" class="form-control" value="{$page['location']}"  />
    </div>
<!-- 售楼处地址 -->
    <div class="form-group">
        <label>售楼处地址</label>
        <input type="text" name="seller_place" placeholder="高新园区软件园" class="form-control" value="{$page['seller_place']}"  />
    </div>
<!-- 开发商 -->
    <div class="form-group">
        <label>开发商</label>
        <input type="text" name="developer" placeholder="大华集团大连置业有限公司" class="form-control" value="{$page['developer']}"  />
    </div>
<!-- 物业类型 -->
    <div class="form-group row">
        <label class="col-sm-1 control-label">物业类型</label>
        <div class="col-sm-11">
            <input type="radio" name="house_type" value="普通住宅" />普通住宅
            <input type="radio" name="house_type" value="别墅" />别墅
            <input type="radio" name="house_type" value="公寓" />公寓                           
        </div>
    </div>
<!-- 物业费用 -->
    <div class="form-group">
        <label>物业费用</label>
        <input type="text" name="fee" placeholder="2.5元/㎡" class="form-control" value="{$page['fee']}"  />
    </div>
<!-- 点评 -->
    <div class="form-group">
        <label>阿帮点评</label>
        <input type="text" name="introduction" value="{$page['introduction']}" class="form-control"  />
    </div>
	
	
	
      <style>
      div.imglist{ margin:0 auto; width:100%; overflow:hidden} 
      div.imglist div{ float:left; margin:4px;padding:2px; width:160px; background-color:#dbdbdb;list-style-type: none; position:relative;} 
      div.imglist div img{ display:block; width:156px; height:156px;} 
      div.imglist div span{ position:absolute;top:2px;right:2px; display:block; width:30px; height:30px; line-height:30px; background:#f00} 
      </style>
	
	
     <!-- 房源图1 -->	
        <div class="form-group">
            <label for="post-title">房源多图集</label>
            <input type="file" name="pic[]" class="form-control" value="{$page['pimgurl_1']}"    multiple="multiple" >
        </div>
		

        <div class="form-group">
		<div class="imglist"> 
        <?php
        $items=$page['pimgurl_1'];  
        $arr = explode("|",$items);
        for($i=0;$i<count($arr)-1;$i++){
        echo "<div class='del_1' data-url='$arr[$i]'><img src='Public/$arr[$i]'  alt=''/><span></span></div>";
        }
        ?>
		</div>
        </div>
		
		
     <!-- 房源图2-->	
        <div class="form-group">
            <label for="post-title">房源图片一</label>
            <input type="file" name="pic1[]" class="form-control" value="{$page['pimgurl_2']}" >
        </div>
		
        <div class="form-group">
		<div class="imglist"> 
        <?php
        $items1=$page['pimgurl_2'];  
        $arr1 = explode("|",$items1);
        for($i=0;$i<count($arr1)-1;$i++){
        echo "<div class='del_2' data-url='$arr1[$i]'><img src='Public/$arr1[$i]' alt=''/><span></span></div>";
        }
        ?>
		</div>
		</div>		
		
     <!-- 房源图3-->	
        <div class="form-group">
            <label for="post-title">房源图片二</label>
            <input type="file" name="pic2[]" class="form-control" value="{$page['pimgurl_3']}" >
        </div>
		
        <div class="form-group">
		<div class="imglist"> 
        <?php
        $items2=$page['pimgurl_3'];  
        $arr2 = explode("|",$items2);
        for($i=0;$i<count($arr2)-1;$i++){
        echo "<div class='del_3' data-url='$arr2[$i]'><img src='Public/$arr2[$i]'  alt=''/><span></span></div>";
        }
        ?>
		</div>

        </div>
		
			
		
<!-- 房源图4 -->	
        <div class="form-group">
            <label for="post-title">房源图片三</label>
            <input type="file" name="pic3[]" class="form-control" value="{$page['pimgurl_4']}"   >
        </div>
		
        <div class="form-group">
		<div class="imglist"> 
        <?php
        $items3=$page['pimgurl_4'];  
        $arr3 = explode("|",$items3);
        for($i=0;$i<count($arr3)-1;$i++){
        echo "<div class='del_4' data-url='$arr3[$i]'><img src='Public/$arr3[$i]'  alt=''/><span></span></div>";
        }
        ?>
		</div>
        </div>
	
	
<!-- 按钮 -->
    <div>
        <a class="btn btn-default btn-success">提交并添加房源</a>
        <input type="submit" class="btn btn-default btn-primary"/>
        <a class="btn btn-default btn-warning">重置</a>
    </div>
</form>
</div>
<include file="Public/footer" />
<script type="text/javascript">
    $('input[name="area"][value="{$page["area"]}"]').attr('checked', true); 
    $('input[name="coupon"][value="{$page["coupon"]}"]').attr('checked', true); 
    $('input[name="house_type"][value="{$page["house_type"]}"]').attr('checked', true);
</script>
<script type="text/javascript">
$(function(){
    $(".del_1").click(function(){
         var delurl = $(this).data("url");
		 $(this).remove();
         var id = GetQueryString("id");
         $.ajax({
            type:"POST",
            url:"{:U('Admin/Project/delarr_1')}",
            data:{
                id:id,
                url:delurl
            },
            success:function(data){
                
            },
            error:function(){
                alert("error");
            }
         })
    });
});

$(function(){
    $(".del_2").click(function(){
         var delurl = $(this).data("url");
		 $(this).remove();
         var id = GetQueryString("id");
         $.ajax({
            type:"POST",
            url:"{:U('Admin/Project/delarr_2')}",
            data:{
                id:id,
                url:delurl
            },
            success:function(data){

            },
            error:function(){
                alert("error");
            }
         })
    });
});

$(function(){
    $(".del_3").click(function(){
         var delurl = $(this).data("url");
		 $(this).remove();
         var id = GetQueryString("id");
         $.ajax({
            type:"POST",
            url:"{:U('Admin/Project/delarr_3')}",
            data:{
                id:id,
                url:delurl
            },
            success:function(data){

            },
            error:function(){
                alert("error");
            }
         })
    });
});

$(function(){
    $(".del_4").click(function(){
         var delurl = $(this).data("url");
		 $(this).remove();
         var id = GetQueryString("id");
         $.ajax({
            type:"POST",
            url:"{:U('Admin/Project/delarr_4')}",
            data:{
                id:id,
                url:delurl
            },
            success:function(data){

            },
            error:function(){
                alert("error");
            }
         })
    });
});





function GetQueryString(name){
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
}
</script>